'use strict';

module.exports = app => {
  class HomeController extends app.Controller {
    
    /**
     * @apiGroup Home
     * @apiVersion 1.0.0
     * @api {get}/ 欢迎页
     * @apiSuccessExample {json} 成功返回示例值:
     *     {
     *       "welcome"
     *     }
     */



    * index() {
      this.ctx.body = "welcome";
      // const db = yield this.service.db.find();
      // this.ctx.body = db;
      // this.ctx.body = values;
      
      // yield app.redis.set('foo', 'bar');
      // get
      // this.ctx.body = yield app.redis.get('foo');
    }
    // * insert() {
      
       
    //    const errors = this.ctx.validate({ name: 'string' }, this.ctx.request.body);
      
    //   // this.ctx.body = errors;
    //   // this.ctx.rotateCsrfSecret();

    //   const obj = this.ctx.request.body;
    //   //console.log(this.ctx.request.body);
    //   const db = yield this.service.db.insert(obj);
    //   this.ctx.body = db;
    //   // this.ctx.body = values;
    // }
  }
  return HomeController;
};
